<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            width: 800px;
            height: 200px;
            margin: auto;
        }
        table{
            width: 600px;
            margin: 10px auto;
            border-collapse:collapse;
            font-size: 14px;
            text-align: center;
        }
        thead tr{
            height: 50px;                              
            background-color: rgb(68, 157, 216);
        }
        tbody tr{
            height: 50px;
            border-collapse:collapse;
        }
        tbody td{
            border-bottom: 1px solid black;
            font-size: 12px;
            color: rgb(46, 46, 48);
        }
    </style>
</head>
<body>
    <div class="box">
        <table>
            <thead>
                 <tr>
                    <th>编号</th>
                    <th>商品姓名</th>
                    <th>单价</th>
                    <th>数量</th>
                 </tr>
            </thead>
            <tbody>
                <tr>
                    <td>01</td>
                    <td>外套</td>
                    <td>99元</td>
                    <td>11</td>
                </tr>
                <tr>
                    <td>02</td>
                    <td>帽子</td>
                    <td>25元</td>
                    <td>25</td>
                </tr>
                <tr>
                    <td>03</td>
                    <td>包</td>
                    <td>100元</td>
                    <td>30</td>
                </tr>
            </tbody>
        </table>
    </div>
    <script>
        const tb = document.querySelector('tbody');
        tb.addEventListener('mouseover',function(evt){
            evt.target.parentNode.style.backgroundColor = 'pink';
        });
        tb.addEventListener('mouseout',function(evt){
            evt.target.parentNode.style.backgroundColor ='';
        });

        // box.addEventListener('mouseover',function(){
        //     box.style.backgroundColor = 'deeppink';
        // });
        // box.addEventListener('mouseout',function(){
        //     box.style.backgroundColor = 'black';
        // })
    </script>
</body>
</html>